#include <assert.h>
#include <string.h>

extern const char *__progname;

static char*
strrchr_safe(const char *s, int c)
{
   char *r = (char*)strrchr(s, c);
   return (r ? r : (char*)s);
}

const char*
bionic_getprogname(void)
{
   return __progname;
}

void
bionic_setprogname(const char *progname)
{
   __progname = strrchr_safe(progname, '/') + 1;
}

